Use dvc config to store and access studio.token#3768
Conversation
856f2d1 to
ebd7749
Compare
| return this.blockAndExecuteProcess(cwd, Command.COMMIT, ...args, Flag.FORCE) | ||
| } | ||
|
|
||
| public config(cwd: string, ...args: Args) { |
There was a problem hiding this comment.
[F] Config doesn't really fit with the reader/executor model as it can both read and write the config. For now, I've put it into executor.
| ) | ||
| } | ||
|
|
||
| const cwd = this.dvcRoots[0] |
There was a problem hiding this comment.
[F] If there is only 1 dvc root in the workspace then we try to clear out the local and global configs. If the user has set the token into their --system config this won't work but I think this approach will get us close enough with the vast majority of users using the extension to manage their token.
| return this.workspaceChanged.fire() | ||
| } | ||
|
|
||
| private getCliCompatible() { |
There was a problem hiding this comment.
[F] Had to wrap this so I could stub it.
| return | ||
| } | ||
|
|
||
| if (this.dvcRoots.length !== 1) { |
There was a problem hiding this comment.
[F] same thing here we are not supporting --local wrt to multiple projects being in the workspace.
ebd7749 to
a097c8b
Compare
| ) | ||
| expect(getDVCAppDir()).toStrictEqual(mockedAppDir + '/' + 'dvc') | ||
| }) | ||
| it('should return the correct path on Windows', () => { |
There was a problem hiding this comment.
Minor, but don't we tent to add lines between it blocks?
| await this.internalCommands.executeCommand( | ||
| AvailableCommands.CONFIG, | ||
| cwd, | ||
| Flag.GLOBAL, |
There was a problem hiding this comment.
Should we mention somewhere that the Studio token is saved globally? Or that users with --system can't remove their tokens?
There was a problem hiding this comment.
The docs say this:
I did consider trying to accommodate "all possibilities" but really we are trying to help beginners with these actions. If the user is competent enough to save a token in their --system config then I do not think they'll try to manage it in this way. I feel like even trying to delete --local is really going above and beyond + makes the code messy enough.
There was a problem hiding this comment.
if anyone complains we will revisit
|
Code Climate has analyzed commit 0e2baf7 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 84.9% (85% is the threshold). This pull request will bring the total coverage in the repository to 94.6% (-0.1% change). View more on Code Climate. |

1/6
main<- this <- #3701 <- #3771 <- #3777 <- #3778 <- #3779One of the checkboxes from #3574
This PR switches us from using VS Code's secret storage API to the
dvc configcommand for storing a user'sstudio.token.Demo
Screen.Recording.2023-04-27.at.1.22.04.pm.mov
Note: We are not currently supporting users using
config.localto store astudio.tokenvalue in monorepos.